<extend name="Base/common"/>
<block name="body">
<link type="text/css" rel="stylesheet" href="__CSS__/group.css"/>
<script type="text/javascript" src="__JS__/common.js"></script>
<div class="clearfix col-xs-12">
<div class="clearfix content-body group_block_border">
<php>
    $user = query_user(array('avatar64','uid','nickname','space_url','rank_link','space_link'),
    $post['uid']);
</php>
	<div class="mod-head">
		<div class="meta">
			<a href="{$user.space_url}" ucard="{$user.uid}"><img width="50" height="50" src="{$user.avatar64}" class="avatar"/></a>
			来自树丛：<a class="c_yellow" href="{:U('Group/Index/group',array('id'=>$post['group_id']))}">{$post.group.title}</a>
			用户：<a href="{$user.space_url}" ucard="{$user.uid}" style="padding-right: 0;">{$user.nickname}</a>{:W('Common/UserRank/render',array($user['uid']))}&nbsp;
			{$post.create_time|friendlyDate='mohu'}&nbsp;
			<php>if(check_auth('Group/Index/edit',get_post_admin($post['id']))){</php>
			<a href="{:U('Index/edit',array('post_id'=>$post['id']))}" class="gray"><i class="iconfont bj">&#xe641;</i>&nbsp;编辑</a>
			<php>}</php>
									
			<php>
				if(check_is_bookmark($post['id'])){
	            	$unDisplay = 'display:';
	            	$Display = 'display:none';
	            }else{
	                $unDisplay = 'display:none';
	                $Display = 'display:';
	            }
	        </php>
	
	        <a title="取消收藏" class="gray" style="{$unDisplay}" data-role="doBookmark" data-url="{:U('Index/doBookmark',array('post_id'=>$post['id'],'flag'=>0))}">
	            <i class="iconfont bj fs18">&#xe619;</i>&nbsp;取消收藏
	        </a>
	
	        <a title="话题收藏" class="c_yellow" data-role="doBookmark" style="{$Display}" data-url="{:U('Index/doBookmark',array('post_id'=>$post['id'],'flag'=>1))}">
	            <i class="iconfont bj fs18">&#xe619;</i>&nbsp;收藏
	        </a>
	
	        <php>if(check_auth('Group/Index/recommend',get_group_admin($post['group_id']))){</php>
	        <php>
	            if(!$post['is_top']){
	                $unDisplayTop = 'display:none';
	                $DisplayTop = 'display:';
	            }else{
	                $unDisplayTop = 'display:';
	                $DisplayTop = 'display:none';
	            }
	        </php>
	        <a title="推荐话题" class="c_yellow" data-role="doSetTop" style="{$DisplayTop}" data-url="{:U('Index/recommend',array('post_id'=>$post['id'],'top'=>1))}">
	            <i class="iconfont bj fs18">&#xe61d;</i>&nbsp;推荐
	        </a>
	
	        <a title="取消推荐" class="gray" data-role="doSetTop" style="{$unDisplayTop}" data-url="{:U('Index/recommend',array('post_id'=>$post['id'],'top'=>0))}">
	            <i class="iconfont bj fs18">&#xe61d;</i>&nbsp;取消推荐
	        </a>
	        <php>}</php>
	
	        <if condition="check_auth('Group/Index/deletePost',get_admin_ids($post['id'],3,0))">
	            <a title="删除" class="gray" href="javascript:" data-role="delPostBtn" data-id="{$post['id']}">
	                <i class="iconfont bj fs18">&#xe61c;</i>&nbsp;删除
	            </a>
	        </if>
	        <div class="pull-right">
	        	<a class="ribbion-green1" href="{:U('group/index/group',array('type'=>'post','id'=>$post['group_id']))}"><i class="iconfont fs12" style="vertical-align: -1px;">&#xe60c;</i>&nbsp;返回树丛</a>
	        </div>
		</div>
	</div>
	<div class="mod-body clearfix">
		<h1>{$post.title}</h1>
		<div class="content-box">
			<if condition="$post['video_url']">
				<div id="flashcontent" style="height:600px;width:800px;margin:0 auto;">
				<embed type="application/x-shockwave-flash" src="{$post.video_url}" width="800" height="600" style="undefined" id="sotester" name="sotester" quality="high" wmode="transparent" scale="noscale" menu="false" allowfullscreen="true" allowScriptAccess="never" flashvars="lm=">
				</div>
				<br />
			</if>
			{$post.content|render}
			<if condition="$post['create_time'] != $post['update_time']">
                <p class="text-muted pull-right">
                    [{:L('_LAST_EDIT_AT_')} {$post['update_time']|time_format} ]
                </p>
            </if>
		</div>
		{:W('Common/Share/detailShare')}
	</div>
	<div class="mod-footer">
		<div class="more-operate">
			<a href="javascript:;"><i class="iconfont fs24">&#xe63a;</i>&nbsp;{$post.view_count}</a>
			{:W('Weibo/Share/shareBtn',array('param'=>array('app'=>'Group','model'=>'GroupPost','method'=>'getPost','id'=>$post['id'],'img'=>get_pic($post['content']),'from'=>'树丛','site_link'=>U('group/index/detail',array('id'=>$post['id']))),'text'=>'分享','css' =>array('style'=>'font-size:18px')))}
			<a href="javascript:;"><i class="iconfont">&#xe631;</i>&nbsp;{$post.reply_count}</a>
			{:Hook('support',array('app'=>'Group',table=>'post','row'=>$post['id'],'uid'=>$post['uid'],'jump'=>'group/index/detail'))}
            
		</div>
	</div>
							
</div>

<div class="clearfix comments">
   	<div class="reply-form clearfix">
		<php>if(is_login()){</php>
            <php>if(is_joined($post['group_id']) != 1 ){</php>
		    <div class="ts">
				您需要加入树丛后才能评论,<a data-role="group_attend" data-group-id="{$post.group_id}">加入树丛</a> 			
			</div>
		    <php>}else{</php>
		    	<div class="replyue clearfix" id="reply_block">
		    	<form id="reply_form" action="{:U('doReply',array('post_id'=>$post['id']))}" method="post" class="ajax-form">
					{:W('Common/Ueditor/editor',array('content','content','','100%','110px'))}
	                    <script>
	                        $(function(){
	                            ue_content.addListener( 'ready', function( editor ) {
	                                $(this.document.body).atwho(atwho_config);
	
	                            } );
	                            ue_content.addListener("beforeSubmit",function(){
	                                ue_content.sync();
	                                $("#reply_form").submit();
	                                return false;
	                            })
	                        })
	                    </script>
			    	<div class="replybtn">
			    		<input type="submit" id="reply_button" value="发布评论"/>
					</div>
				</div> 
		    	</form>
		    <php>}</php>
		<php>}else{</php>
		<div class="ts">
			您需要登录后才能评论      <a href="{:U('Ucenter/Member/login')}">登录</a> <span>|</span> <a href="{:U('Ucenter/Member/register')}">立刻注册</a>			
		</div>
		<php>}</php>
	</div>
    
    <div class="comments-nav">
		<ul>
			<li><a href="#">最新评论</a></li>
		</ul>
		<h4>共 {$post.reply_count}人评论</h4>
	</div>
    <section class="comments-list clearfix">
        <empty name="replyList"><div id="empty" class="text-muted text-center" ><i class="icon-inbox"></i> 暂无评论</div></empty>
        <volist name="replyList" id="reply" key="k">
    		{:W('Group/Detail/reply',array('reply_id'=>$reply,'param'=>array('k'=>$k)))}
		</volist>
        <div class="pager">
            {:getPagination($replyTotalCount)}
        </div>
    </section>
</div>


</div>


<script>
    $(function () {
        $('.input_tips').keypress(function (e) {
           var $this = $(this);
            if (e.ctrlKey && e.which == 13 || e.which == 10) {
              $this.closest('.weibo_post_box').find('[data-role="sendLzlReply"]').click();
            }
        });

        $.post(U('Core/Public/atWhoJson'),{},function(res){
            atwho_config = {
                at: "@",
                data: res,
                tpl: "<li data-value='[at:${id}]'><img class='avatar-img' style='width:2em;margin-right: 0.6em' src='${avatar32}'/>${nickname}</li>",
                show_the_at: true,
                search_key: 'search_key',
                start_with_space: false
            };
        },'json')
    })
</script>
<script>
    $(document).ready(function () {
        $('.popup-gallery').each(function () { // the containers for all your galleries
            $(this).magnificPopup({
                delegate: '.popup',
                type: 'image',
                tLoading: 'Loading image #%curr%...',
                mainClass: 'mfp-img-mobile',
                gallery: {
                    enabled: true,
                    navigateByImgClick: true,
                    preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
                },
                image: {
                    tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
                    titleSrc: function (item) {
                        /*           return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';*/
                        return '';
                    }
                }
            });
        });
    });
</script>
<style>
    .group-first-block {
        background: white;
        box-shadow: 0 0 5px rgb(204, 204, 204);
        -moz-box-shadow: 0 0 5px #CCCCCC;
        -khtml-box-shadow: 0 0 5px #CCCCCC;
        margin-top: 15px;
    }
</style>
<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/third-party/SyntaxHighlighter/shCore.js"></script>
<link rel="stylesheet" type="text/css" href="__STATIC__/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css"/>
<script type="text/javascript">
    SyntaxHighlighter.all();
</script>
</block>
